<?php
if (session_id() == "") session_start(); // Initialize Session data
ob_start(); // Turn on output buffering
?>
<?php include_once "ewcfg10.php" ?>
<?php include_once "ewmysql10.php" ?>
<?php include_once "phpfn10.php" ?>
<?php include_once "auditoriasinfo.php" ?>
<?php include_once "usuariosinfo.php" ?>
<?php include_once "userfn10.php" ?>
<?php

//
// Page class
//

$auditorias_edit = NULL; // Initialize page object first

class cauditorias_edit extends cauditorias {

	// Page ID
	var $PageID = 'edit';

	// Project ID
	var $ProjectID = "{0077F69D-1CA4-4B45-8DC5-8692146F4B48}";

	// Table name
	var $TableName = 'auditorias';

	// Page object name
	var $PageObjName = 'auditorias_edit';

	// Page name
	function PageName() {
		return ew_CurrentPage();
	}

	// Page URL
	function PageUrl() {
		$PageUrl = ew_CurrentPage() . "?";
		if ($this->UseTokenInUrl) $PageUrl .= "t=" . $this->TableVar . "&"; // Add page token
		return $PageUrl;
	}

	// Message
	function getMessage() {
		return @$_SESSION[EW_SESSION_MESSAGE];
	}

	function setMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_MESSAGE], $v);
	}

	function getFailureMessage() {
		return @$_SESSION[EW_SESSION_FAILURE_MESSAGE];
	}

	function setFailureMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_FAILURE_MESSAGE], $v);
	}

	function getSuccessMessage() {
		return @$_SESSION[EW_SESSION_SUCCESS_MESSAGE];
	}

	function setSuccessMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_SUCCESS_MESSAGE], $v);
	}

	function getWarningMessage() {
		return @$_SESSION[EW_SESSION_WARNING_MESSAGE];
	}

	function setWarningMessage($v) {
		ew_AddMessage($_SESSION[EW_SESSION_WARNING_MESSAGE], $v);
	}

	// Show message
	function ShowMessage() {
		$hidden = FALSE;
		$html = "";

		// Message
		$sMessage = $this->getMessage();
		$this->Message_Showing($sMessage, "");
		if ($sMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sMessage . "</div>";
			$_SESSION[EW_SESSION_MESSAGE] = ""; // Clear message in Session
		}

		// Warning message
		$sWarningMessage = $this->getWarningMessage();
		$this->Message_Showing($sWarningMessage, "warning");
		if ($sWarningMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sWarningMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sWarningMessage;
			$html .= "<div class=\"alert alert-warning ewWarning\">" . $sWarningMessage . "</div>";
			$_SESSION[EW_SESSION_WARNING_MESSAGE] = ""; // Clear message in Session
		}

		// Success message
		$sSuccessMessage = $this->getSuccessMessage();
		$this->Message_Showing($sSuccessMessage, "success");
		if ($sSuccessMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sSuccessMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sSuccessMessage;
			$html .= "<div class=\"alert alert-success ewSuccess\">" . $sSuccessMessage . "</div>";
			$_SESSION[EW_SESSION_SUCCESS_MESSAGE] = ""; // Clear message in Session
		}

		// Failure message
		$sErrorMessage = $this->getFailureMessage();
		$this->Message_Showing($sErrorMessage, "failure");
		if ($sErrorMessage <> "") { // Message in Session, display
			if (!$hidden)
				$sErrorMessage = "<button type=\"button\" class=\"close\" data-dismiss=\"alert\">&times;</button>" . $sErrorMessage;
			$html .= "<div class=\"alert alert-error ewError\">" . $sErrorMessage . "</div>";
			$_SESSION[EW_SESSION_FAILURE_MESSAGE] = ""; // Clear message in Session
		}
		echo "<table class=\"ewStdTable\"><tr><td><div class=\"ewMessageDialog\"" . (($hidden) ? " style=\"display: none;\"" : "") . ">" . $html . "</div></td></tr></table>";
	}
	var $PageHeader;
	var $PageFooter;

	// Show Page Header
	function ShowPageHeader() {
		$sHeader = $this->PageHeader;
		$this->Page_DataRendering($sHeader);
		if ($sHeader <> "") { // Header exists, display
			echo "<p>" . $sHeader . "</p>";
		}
	}

	// Show Page Footer
	function ShowPageFooter() {
		$sFooter = $this->PageFooter;
		$this->Page_DataRendered($sFooter);
		if ($sFooter <> "") { // Footer exists, display
			echo "<p>" . $sFooter . "</p>";
		}
	}

	// Validate page request
	function IsPageRequest() {
		global $objForm;
		if ($this->UseTokenInUrl) {
			if ($objForm)
				return ($this->TableVar == $objForm->GetValue("t"));
			if (@$_GET["t"] <> "")
				return ($this->TableVar == $_GET["t"]);
		} else {
			return TRUE;
		}
	}

	//
	// Page class constructor
	//
	function __construct() {
		global $conn, $Language;
		$GLOBALS["Page"] = &$this;

		// Language object
		if (!isset($Language)) $Language = new cLanguage();

		// Parent constuctor
		parent::__construct();

		// Table object (auditorias)
		if (!isset($GLOBALS["auditorias"]) || get_class($GLOBALS["auditorias"]) == "cauditorias") {
			$GLOBALS["auditorias"] = &$this;
			$GLOBALS["Table"] = &$GLOBALS["auditorias"];
		}

		// Table object (usuarios)
		if (!isset($GLOBALS['usuarios'])) $GLOBALS['usuarios'] = new cusuarios();

		// Page ID
		if (!defined("EW_PAGE_ID"))
			define("EW_PAGE_ID", 'edit', TRUE);

		// Table name (for backward compatibility)
		if (!defined("EW_TABLE_NAME"))
			define("EW_TABLE_NAME", 'auditorias', TRUE);

		// Start timer
		if (!isset($GLOBALS["gTimer"])) $GLOBALS["gTimer"] = new cTimer();

		// Open connection
		if (!isset($conn)) $conn = ew_Connect();
	}

	// 
	//  Page_Init
	//
	function Page_Init() {
		global $gsExport, $gsExportFile, $UserProfile, $Language, $Security, $objForm;

		// Security
		$Security = new cAdvancedSecurity();
		if (!$Security->IsLoggedIn()) $Security->AutoLogin();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}
		$Security->TablePermission_Loading();
		$Security->LoadCurrentUserLevel($this->ProjectID . $this->TableName);
		$Security->TablePermission_Loaded();
		if (!$Security->IsLoggedIn()) {
			$Security->SaveLastUrl();
			$this->Page_Terminate("login.php");
		}
		if (!$Security->CanEdit()) {
			$Security->SaveLastUrl();
			$this->setFailureMessage($Language->Phrase("NoPermission")); // Set no permission
			$this->Page_Terminate("auditoriaslist.php");
		}

		// Create form object
		$objForm = new cFormObj();
		$this->CurrentAction = (@$_GET["a"] <> "") ? $_GET["a"] : @$_POST["a_list"]; // Set up current action
		$this->Auditoria->Visible = !$this->IsAdd() && !$this->IsCopy() && !$this->IsGridAdd();

		// Global Page Loading event (in userfn*.php)
		Page_Loading();

		// Page Load event
		$this->Page_Load();
	}

	//
	// Page_Terminate
	//
	function Page_Terminate($url = "") {
		global $conn;

		// Page Unload event
		$this->Page_Unload();

		// Global Page Unloaded event (in userfn*.php)
		Page_Unloaded();
		$this->Page_Redirecting($url);

		 // Close connection
		$conn->Close();

		// Go to URL if specified
		if ($url <> "") {
			if (!EW_DEBUG_ENABLED && ob_get_length())
				ob_end_clean();
			header("Location: " . $url);
		}
		exit();
	}
	var $DbMasterFilter;
	var $DbDetailFilter;

	// 
	// Page main
	//
	function Page_Main() {
		global $objForm, $Language, $gsFormError;

		// Load key from QueryString
		if (@$_GET["Auditoria"] <> "") {
			$this->Auditoria->setQueryStringValue($_GET["Auditoria"]);
		}

		// Set up Breadcrumb
		$this->SetupBreadcrumb();

		// Process form if post back
		if (@$_POST["a_edit"] <> "") {
			$this->CurrentAction = $_POST["a_edit"]; // Get action code
			$this->LoadFormValues(); // Get form values
		} else {
			$this->CurrentAction = "I"; // Default action is display
		}

		// Check if valid key
		if ($this->Auditoria->CurrentValue == "")
			$this->Page_Terminate("auditoriaslist.php"); // Invalid key, return to list

		// Validate form if post back
		if (@$_POST["a_edit"] <> "") {
			if (!$this->ValidateForm()) {
				$this->CurrentAction = ""; // Form error, reset action
				$this->setFailureMessage($gsFormError);
				$this->EventCancelled = TRUE; // Event cancelled
				$this->RestoreFormValues();
			}
		}
		switch ($this->CurrentAction) {
			case "I": // Get a record to display
				if (!$this->LoadRow()) { // Load record based on key
					if ($this->getFailureMessage() == "") $this->setFailureMessage($Language->Phrase("NoRecord")); // No record found
					$this->Page_Terminate("auditoriaslist.php"); // No matching record, return to list
				}
				break;
			Case "U": // Update
				$this->SendEmail = TRUE; // Send email on update success
				if ($this->EditRow()) { // Update record based on key
					if ($this->getSuccessMessage() == "")
						$this->setSuccessMessage($Language->Phrase("UpdateSuccess")); // Update success
					$sReturnUrl = $this->getReturnUrl();
					$this->Page_Terminate($sReturnUrl); // Return to caller
				} else {
					$this->EventCancelled = TRUE; // Event cancelled
					$this->RestoreFormValues(); // Restore form values if update failed
				}
		}

		// Render the record
		$this->RowType = EW_ROWTYPE_EDIT; // Render as Edit
		$this->ResetAttrs();
		$this->RenderRow();
	}

	// Set up starting record parameters
	function SetUpStartRec() {
		if ($this->DisplayRecs == 0)
			return;
		if ($this->IsPageRequest()) { // Validate request
			if (@$_GET[EW_TABLE_START_REC] <> "") { // Check for "start" parameter
				$this->StartRec = $_GET[EW_TABLE_START_REC];
				$this->setStartRecordNumber($this->StartRec);
			} elseif (@$_GET[EW_TABLE_PAGE_NO] <> "") {
				$PageNo = $_GET[EW_TABLE_PAGE_NO];
				if (is_numeric($PageNo)) {
					$this->StartRec = ($PageNo-1)*$this->DisplayRecs+1;
					if ($this->StartRec <= 0) {
						$this->StartRec = 1;
					} elseif ($this->StartRec >= intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1) {
						$this->StartRec = intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1;
					}
					$this->setStartRecordNumber($this->StartRec);
				}
			}
		}
		$this->StartRec = $this->getStartRecordNumber();

		// Check if correct start record counter
		if (!is_numeric($this->StartRec) || $this->StartRec == "") { // Avoid invalid start record counter
			$this->StartRec = 1; // Reset start record counter
			$this->setStartRecordNumber($this->StartRec);
		} elseif (intval($this->StartRec) > intval($this->TotalRecs)) { // Avoid starting record > total records
			$this->StartRec = intval(($this->TotalRecs-1)/$this->DisplayRecs)*$this->DisplayRecs+1; // Point to last page first record
			$this->setStartRecordNumber($this->StartRec);
		} elseif (($this->StartRec-1) % $this->DisplayRecs <> 0) {
			$this->StartRec = intval(($this->StartRec-1)/$this->DisplayRecs)*$this->DisplayRecs+1; // Point to page boundary
			$this->setStartRecordNumber($this->StartRec);
		}
	}

	// Get upload files
	function GetUploadFiles() {
		global $objForm;

		// Get upload data
	}

	// Load form values
	function LoadFormValues() {

		// Load from form
		global $objForm;
		if (!$this->Auditoria->FldIsDetailKey)
			$this->Auditoria->setFormValue($objForm->GetValue("x_Auditoria"));
		if (!$this->AuditoriaFecha->FldIsDetailKey) {
			$this->AuditoriaFecha->setFormValue($objForm->GetValue("x_AuditoriaFecha"));
			$this->AuditoriaFecha->CurrentValue = ew_UnFormatDateTime($this->AuditoriaFecha->CurrentValue, 7);
		}
		if (!$this->AuditoriaTipo->FldIsDetailKey) {
			$this->AuditoriaTipo->setFormValue($objForm->GetValue("x_AuditoriaTipo"));
		}
		if (!$this->AuditoriaSucursal->FldIsDetailKey) {
			$this->AuditoriaSucursal->setFormValue($objForm->GetValue("x_AuditoriaSucursal"));
		}
		if (!$this->AuditoriaCreo->FldIsDetailKey) {
			$this->AuditoriaCreo->setFormValue($objForm->GetValue("x_AuditoriaCreo"));
		}
		if (!$this->AuditoriaResponsable->FldIsDetailKey) {
			$this->AuditoriaResponsable->setFormValue($objForm->GetValue("x_AuditoriaResponsable"));
		}
		if (!$this->AuditoriaFechaVisita->FldIsDetailKey) {
			$this->AuditoriaFechaVisita->setFormValue($objForm->GetValue("x_AuditoriaFechaVisita"));
			$this->AuditoriaFechaVisita->CurrentValue = ew_UnFormatDateTime($this->AuditoriaFechaVisita->CurrentValue, 7);
		}
		if (!$this->AuditoriaResultado->FldIsDetailKey) {
			$this->AuditoriaResultado->setFormValue($objForm->GetValue("x_AuditoriaResultado"));
		}
		if (!$this->AuditoriaObservacion->FldIsDetailKey) {
			$this->AuditoriaObservacion->setFormValue($objForm->GetValue("x_AuditoriaObservacion"));
		}
		if (!$this->AuditoriaPublicar->FldIsDetailKey) {
			$this->AuditoriaPublicar->setFormValue($objForm->GetValue("x_AuditoriaPublicar"));
		}
		if (!$this->AuditoriaEstado->FldIsDetailKey) {
			$this->AuditoriaEstado->setFormValue($objForm->GetValue("x_AuditoriaEstado"));
		}
		if (!$this->AuditoriaDescargo->FldIsDetailKey) {
			$this->AuditoriaDescargo->setFormValue($objForm->GetValue("x_AuditoriaDescargo"));
		}
		if (!$this->AuditoriaFechaCierre->FldIsDetailKey) {
			$this->AuditoriaFechaCierre->setFormValue($objForm->GetValue("x_AuditoriaFechaCierre"));
			$this->AuditoriaFechaCierre->CurrentValue = ew_UnFormatDateTime($this->AuditoriaFechaCierre->CurrentValue, 7);
		}
	}

	// Restore form values
	function RestoreFormValues() {
		global $objForm;
		$this->LoadRow();
		$this->Auditoria->CurrentValue = $this->Auditoria->FormValue;
		$this->AuditoriaFecha->CurrentValue = $this->AuditoriaFecha->FormValue;
		$this->AuditoriaFecha->CurrentValue = ew_UnFormatDateTime($this->AuditoriaFecha->CurrentValue, 7);
		$this->AuditoriaTipo->CurrentValue = $this->AuditoriaTipo->FormValue;
		$this->AuditoriaSucursal->CurrentValue = $this->AuditoriaSucursal->FormValue;
		$this->AuditoriaCreo->CurrentValue = $this->AuditoriaCreo->FormValue;
		$this->AuditoriaResponsable->CurrentValue = $this->AuditoriaResponsable->FormValue;
		$this->AuditoriaFechaVisita->CurrentValue = $this->AuditoriaFechaVisita->FormValue;
		$this->AuditoriaFechaVisita->CurrentValue = ew_UnFormatDateTime($this->AuditoriaFechaVisita->CurrentValue, 7);
		$this->AuditoriaResultado->CurrentValue = $this->AuditoriaResultado->FormValue;
		$this->AuditoriaObservacion->CurrentValue = $this->AuditoriaObservacion->FormValue;
		$this->AuditoriaPublicar->CurrentValue = $this->AuditoriaPublicar->FormValue;
		$this->AuditoriaEstado->CurrentValue = $this->AuditoriaEstado->FormValue;
		$this->AuditoriaDescargo->CurrentValue = $this->AuditoriaDescargo->FormValue;
		$this->AuditoriaFechaCierre->CurrentValue = $this->AuditoriaFechaCierre->FormValue;
		$this->AuditoriaFechaCierre->CurrentValue = ew_UnFormatDateTime($this->AuditoriaFechaCierre->CurrentValue, 7);
	}

	// Load row based on key values
	function LoadRow() {
		global $conn, $Security, $Language;
		$sFilter = $this->KeyFilter();

		// Call Row Selecting event
		$this->Row_Selecting($sFilter);

		// Load SQL based on filter
		$this->CurrentFilter = $sFilter;
		$sSql = $this->SQL();
		$res = FALSE;
		$rs = ew_LoadRecordset($sSql);
		if ($rs && !$rs->EOF) {
			$res = TRUE;
			$this->LoadRowValues($rs); // Load row values
			$rs->Close();
		}
		return $res;
	}

	// Load row values from recordset
	function LoadRowValues(&$rs) {
		global $conn;
		if (!$rs || $rs->EOF) return;

		// Call Row Selected event
		$row = &$rs->fields;
		$this->Row_Selected($row);
		$this->Auditoria->setDbValue($rs->fields('Auditoria'));
		$this->AuditoriaFecha->setDbValue($rs->fields('AuditoriaFecha'));
		$this->AuditoriaTipo->setDbValue($rs->fields('AuditoriaTipo'));
		$this->AuditoriaSucursal->setDbValue($rs->fields('AuditoriaSucursal'));
		$this->AuditoriaCreo->setDbValue($rs->fields('AuditoriaCreo'));
		$this->AuditoriaResponsable->setDbValue($rs->fields('AuditoriaResponsable'));
		$this->AuditoriaFechaVisita->setDbValue($rs->fields('AuditoriaFechaVisita'));
		$this->AuditoriaResultado->setDbValue($rs->fields('AuditoriaResultado'));
		$this->AuditoriaObservacion->setDbValue($rs->fields('AuditoriaObservacion'));
		$this->AuditoriaPublicar->setDbValue($rs->fields('AuditoriaPublicar'));
		$this->AuditoriaEstado->setDbValue($rs->fields('AuditoriaEstado'));
		$this->AuditoriaDescargo->setDbValue($rs->fields('AuditoriaDescargo'));
		$this->AuditoriaFechaCierre->setDbValue($rs->fields('AuditoriaFechaCierre'));
	}

	// Load DbValue from recordset
	function LoadDbValues(&$rs) {
		if (!$rs || !is_array($rs) && $rs->EOF) return;
		$row = is_array($rs) ? $rs : $rs->fields;
		$this->Auditoria->DbValue = $row['Auditoria'];
		$this->AuditoriaFecha->DbValue = $row['AuditoriaFecha'];
		$this->AuditoriaTipo->DbValue = $row['AuditoriaTipo'];
		$this->AuditoriaSucursal->DbValue = $row['AuditoriaSucursal'];
		$this->AuditoriaCreo->DbValue = $row['AuditoriaCreo'];
		$this->AuditoriaResponsable->DbValue = $row['AuditoriaResponsable'];
		$this->AuditoriaFechaVisita->DbValue = $row['AuditoriaFechaVisita'];
		$this->AuditoriaResultado->DbValue = $row['AuditoriaResultado'];
		$this->AuditoriaObservacion->DbValue = $row['AuditoriaObservacion'];
		$this->AuditoriaPublicar->DbValue = $row['AuditoriaPublicar'];
		$this->AuditoriaEstado->DbValue = $row['AuditoriaEstado'];
		$this->AuditoriaDescargo->DbValue = $row['AuditoriaDescargo'];
		$this->AuditoriaFechaCierre->DbValue = $row['AuditoriaFechaCierre'];
	}

	// Render row values based on field settings
	function RenderRow() {
		global $conn, $Security, $Language;
		global $gsLanguage;

		// Initialize URLs
		// Call Row_Rendering event

		$this->Row_Rendering();

		// Common render codes for all row types
		// Auditoria
		// AuditoriaFecha
		// AuditoriaTipo
		// AuditoriaSucursal
		// AuditoriaCreo
		// AuditoriaResponsable
		// AuditoriaFechaVisita
		// AuditoriaResultado
		// AuditoriaObservacion
		// AuditoriaPublicar
		// AuditoriaEstado
		// AuditoriaDescargo
		// AuditoriaFechaCierre

		if ($this->RowType == EW_ROWTYPE_VIEW) { // View row

			// Auditoria
			$this->Auditoria->ViewValue = $this->Auditoria->CurrentValue;
			$this->Auditoria->ViewCustomAttributes = "";

			// AuditoriaFecha
			$this->AuditoriaFecha->ViewValue = $this->AuditoriaFecha->CurrentValue;
			$this->AuditoriaFecha->ViewValue = ew_FormatDateTime($this->AuditoriaFecha->ViewValue, 7);
			$this->AuditoriaFecha->ViewCustomAttributes = "";

			// AuditoriaTipo
			$this->AuditoriaTipo->ViewValue = $this->AuditoriaTipo->CurrentValue;
			$this->AuditoriaTipo->ViewCustomAttributes = "";

			// AuditoriaSucursal
			$this->AuditoriaSucursal->ViewValue = $this->AuditoriaSucursal->CurrentValue;
			$this->AuditoriaSucursal->ViewCustomAttributes = "";

			// AuditoriaCreo
			$this->AuditoriaCreo->ViewValue = $this->AuditoriaCreo->CurrentValue;
			$this->AuditoriaCreo->ViewCustomAttributes = "";

			// AuditoriaResponsable
			$this->AuditoriaResponsable->ViewValue = $this->AuditoriaResponsable->CurrentValue;
			$this->AuditoriaResponsable->ViewCustomAttributes = "";

			// AuditoriaFechaVisita
			$this->AuditoriaFechaVisita->ViewValue = $this->AuditoriaFechaVisita->CurrentValue;
			$this->AuditoriaFechaVisita->ViewValue = ew_FormatDateTime($this->AuditoriaFechaVisita->ViewValue, 7);
			$this->AuditoriaFechaVisita->ViewCustomAttributes = "";

			// AuditoriaResultado
			$this->AuditoriaResultado->ViewValue = $this->AuditoriaResultado->CurrentValue;
			$this->AuditoriaResultado->ViewCustomAttributes = "";

			// AuditoriaObservacion
			$this->AuditoriaObservacion->ViewValue = $this->AuditoriaObservacion->CurrentValue;
			$this->AuditoriaObservacion->ViewCustomAttributes = "";

			// AuditoriaPublicar
			$this->AuditoriaPublicar->ViewValue = $this->AuditoriaPublicar->CurrentValue;
			$this->AuditoriaPublicar->ViewCustomAttributes = "";

			// AuditoriaEstado
			$this->AuditoriaEstado->ViewValue = $this->AuditoriaEstado->CurrentValue;
			$this->AuditoriaEstado->ViewCustomAttributes = "";

			// AuditoriaDescargo
			$this->AuditoriaDescargo->ViewValue = $this->AuditoriaDescargo->CurrentValue;
			$this->AuditoriaDescargo->ViewCustomAttributes = "";

			// AuditoriaFechaCierre
			$this->AuditoriaFechaCierre->ViewValue = $this->AuditoriaFechaCierre->CurrentValue;
			$this->AuditoriaFechaCierre->ViewValue = ew_FormatDateTime($this->AuditoriaFechaCierre->ViewValue, 7);
			$this->AuditoriaFechaCierre->ViewCustomAttributes = "";

			// Auditoria
			$this->Auditoria->LinkCustomAttributes = "";
			$this->Auditoria->HrefValue = "";
			$this->Auditoria->TooltipValue = "";

			// AuditoriaFecha
			$this->AuditoriaFecha->LinkCustomAttributes = "";
			$this->AuditoriaFecha->HrefValue = "";
			$this->AuditoriaFecha->TooltipValue = "";

			// AuditoriaTipo
			$this->AuditoriaTipo->LinkCustomAttributes = "";
			$this->AuditoriaTipo->HrefValue = "";
			$this->AuditoriaTipo->TooltipValue = "";

			// AuditoriaSucursal
			$this->AuditoriaSucursal->LinkCustomAttributes = "";
			$this->AuditoriaSucursal->HrefValue = "";
			$this->AuditoriaSucursal->TooltipValue = "";

			// AuditoriaCreo
			$this->AuditoriaCreo->LinkCustomAttributes = "";
			$this->AuditoriaCreo->HrefValue = "";
			$this->AuditoriaCreo->TooltipValue = "";

			// AuditoriaResponsable
			$this->AuditoriaResponsable->LinkCustomAttributes = "";
			$this->AuditoriaResponsable->HrefValue = "";
			$this->AuditoriaResponsable->TooltipValue = "";

			// AuditoriaFechaVisita
			$this->AuditoriaFechaVisita->LinkCustomAttributes = "";
			$this->AuditoriaFechaVisita->HrefValue = "";
			$this->AuditoriaFechaVisita->TooltipValue = "";

			// AuditoriaResultado
			$this->AuditoriaResultado->LinkCustomAttributes = "";
			$this->AuditoriaResultado->HrefValue = "";
			$this->AuditoriaResultado->TooltipValue = "";

			// AuditoriaObservacion
			$this->AuditoriaObservacion->LinkCustomAttributes = "";
			$this->AuditoriaObservacion->HrefValue = "";
			$this->AuditoriaObservacion->TooltipValue = "";

			// AuditoriaPublicar
			$this->AuditoriaPublicar->LinkCustomAttributes = "";
			$this->AuditoriaPublicar->HrefValue = "";
			$this->AuditoriaPublicar->TooltipValue = "";

			// AuditoriaEstado
			$this->AuditoriaEstado->LinkCustomAttributes = "";
			$this->AuditoriaEstado->HrefValue = "";
			$this->AuditoriaEstado->TooltipValue = "";

			// AuditoriaDescargo
			$this->AuditoriaDescargo->LinkCustomAttributes = "";
			$this->AuditoriaDescargo->HrefValue = "";
			$this->AuditoriaDescargo->TooltipValue = "";

			// AuditoriaFechaCierre
			$this->AuditoriaFechaCierre->LinkCustomAttributes = "";
			$this->AuditoriaFechaCierre->HrefValue = "";
			$this->AuditoriaFechaCierre->TooltipValue = "";
		} elseif ($this->RowType == EW_ROWTYPE_EDIT) { // Edit row

			// Auditoria
			$this->Auditoria->EditCustomAttributes = "";
			$this->Auditoria->EditValue = $this->Auditoria->CurrentValue;
			$this->Auditoria->ViewCustomAttributes = "";

			// AuditoriaFecha
			$this->AuditoriaFecha->EditCustomAttributes = "";
			$this->AuditoriaFecha->EditValue = ew_HtmlEncode(ew_FormatDateTime($this->AuditoriaFecha->CurrentValue, 7));
			$this->AuditoriaFecha->PlaceHolder = ew_RemoveHtml($this->AuditoriaFecha->FldCaption());

			// AuditoriaTipo
			$this->AuditoriaTipo->EditCustomAttributes = "";
			$this->AuditoriaTipo->EditValue = ew_HtmlEncode($this->AuditoriaTipo->CurrentValue);
			$this->AuditoriaTipo->PlaceHolder = ew_RemoveHtml($this->AuditoriaTipo->FldCaption());

			// AuditoriaSucursal
			$this->AuditoriaSucursal->EditCustomAttributes = "";
			$this->AuditoriaSucursal->EditValue = ew_HtmlEncode($this->AuditoriaSucursal->CurrentValue);
			$this->AuditoriaSucursal->PlaceHolder = ew_RemoveHtml($this->AuditoriaSucursal->FldCaption());

			// AuditoriaCreo
			$this->AuditoriaCreo->EditCustomAttributes = "";
			$this->AuditoriaCreo->EditValue = ew_HtmlEncode($this->AuditoriaCreo->CurrentValue);
			$this->AuditoriaCreo->PlaceHolder = ew_RemoveHtml($this->AuditoriaCreo->FldCaption());

			// AuditoriaResponsable
			$this->AuditoriaResponsable->EditCustomAttributes = "";
			$this->AuditoriaResponsable->EditValue = ew_HtmlEncode($this->AuditoriaResponsable->CurrentValue);
			$this->AuditoriaResponsable->PlaceHolder = ew_RemoveHtml($this->AuditoriaResponsable->FldCaption());

			// AuditoriaFechaVisita
			$this->AuditoriaFechaVisita->EditCustomAttributes = "";
			$this->AuditoriaFechaVisita->EditValue = ew_HtmlEncode(ew_FormatDateTime($this->AuditoriaFechaVisita->CurrentValue, 7));
			$this->AuditoriaFechaVisita->PlaceHolder = ew_RemoveHtml($this->AuditoriaFechaVisita->FldCaption());

			// AuditoriaResultado
			$this->AuditoriaResultado->EditCustomAttributes = "";
			$this->AuditoriaResultado->EditValue = ew_HtmlEncode($this->AuditoriaResultado->CurrentValue);
			$this->AuditoriaResultado->PlaceHolder = ew_RemoveHtml($this->AuditoriaResultado->FldCaption());

			// AuditoriaObservacion
			$this->AuditoriaObservacion->EditCustomAttributes = "";
			$this->AuditoriaObservacion->EditValue = ew_HtmlEncode($this->AuditoriaObservacion->CurrentValue);
			$this->AuditoriaObservacion->PlaceHolder = ew_RemoveHtml($this->AuditoriaObservacion->FldCaption());

			// AuditoriaPublicar
			$this->AuditoriaPublicar->EditCustomAttributes = "";
			$this->AuditoriaPublicar->EditValue = ew_HtmlEncode($this->AuditoriaPublicar->CurrentValue);
			$this->AuditoriaPublicar->PlaceHolder = ew_RemoveHtml($this->AuditoriaPublicar->FldCaption());

			// AuditoriaEstado
			$this->AuditoriaEstado->EditCustomAttributes = "";
			$this->AuditoriaEstado->EditValue = ew_HtmlEncode($this->AuditoriaEstado->CurrentValue);
			$this->AuditoriaEstado->PlaceHolder = ew_RemoveHtml($this->AuditoriaEstado->FldCaption());

			// AuditoriaDescargo
			$this->AuditoriaDescargo->EditCustomAttributes = "";
			$this->AuditoriaDescargo->EditValue = $this->AuditoriaDescargo->CurrentValue;
			$this->AuditoriaDescargo->PlaceHolder = ew_RemoveHtml($this->AuditoriaDescargo->FldCaption());

			// AuditoriaFechaCierre
			$this->AuditoriaFechaCierre->EditCustomAttributes = "";
			$this->AuditoriaFechaCierre->EditValue = ew_HtmlEncode(ew_FormatDateTime($this->AuditoriaFechaCierre->CurrentValue, 7));
			$this->AuditoriaFechaCierre->PlaceHolder = ew_RemoveHtml($this->AuditoriaFechaCierre->FldCaption());

			// Edit refer script
			// Auditoria

			$this->Auditoria->HrefValue = "";

			// AuditoriaFecha
			$this->AuditoriaFecha->HrefValue = "";

			// AuditoriaTipo
			$this->AuditoriaTipo->HrefValue = "";

			// AuditoriaSucursal
			$this->AuditoriaSucursal->HrefValue = "";

			// AuditoriaCreo
			$this->AuditoriaCreo->HrefValue = "";

			// AuditoriaResponsable
			$this->AuditoriaResponsable->HrefValue = "";

			// AuditoriaFechaVisita
			$this->AuditoriaFechaVisita->HrefValue = "";

			// AuditoriaResultado
			$this->AuditoriaResultado->HrefValue = "";

			// AuditoriaObservacion
			$this->AuditoriaObservacion->HrefValue = "";

			// AuditoriaPublicar
			$this->AuditoriaPublicar->HrefValue = "";

			// AuditoriaEstado
			$this->AuditoriaEstado->HrefValue = "";

			// AuditoriaDescargo
			$this->AuditoriaDescargo->HrefValue = "";

			// AuditoriaFechaCierre
			$this->AuditoriaFechaCierre->HrefValue = "";
		}
		if ($this->RowType == EW_ROWTYPE_ADD ||
			$this->RowType == EW_ROWTYPE_EDIT ||
			$this->RowType == EW_ROWTYPE_SEARCH) { // Add / Edit / Search row
			$this->SetupFieldTitles();
		}

		// Call Row Rendered event
		if ($this->RowType <> EW_ROWTYPE_AGGREGATEINIT)
			$this->Row_Rendered();
	}

	// Validate form
	function ValidateForm() {
		global $Language, $gsFormError;

		// Initialize form error message
		$gsFormError = "";

		// Check if validation required
		if (!EW_SERVER_VALIDATE)
			return ($gsFormError == "");
		if (!ew_CheckEuroDate($this->AuditoriaFecha->FormValue)) {
			ew_AddMessage($gsFormError, $this->AuditoriaFecha->FldErrMsg());
		}
		if (!ew_CheckInteger($this->AuditoriaTipo->FormValue)) {
			ew_AddMessage($gsFormError, $this->AuditoriaTipo->FldErrMsg());
		}
		if (!ew_CheckInteger($this->AuditoriaSucursal->FormValue)) {
			ew_AddMessage($gsFormError, $this->AuditoriaSucursal->FldErrMsg());
		}
		if (!ew_CheckInteger($this->AuditoriaCreo->FormValue)) {
			ew_AddMessage($gsFormError, $this->AuditoriaCreo->FldErrMsg());
		}
		if (!ew_CheckInteger($this->AuditoriaResponsable->FormValue)) {
			ew_AddMessage($gsFormError, $this->AuditoriaResponsable->FldErrMsg());
		}
		if (!ew_CheckEuroDate($this->AuditoriaFechaVisita->FormValue)) {
			ew_AddMessage($gsFormError, $this->AuditoriaFechaVisita->FldErrMsg());
		}
		if (!ew_CheckInteger($this->AuditoriaResultado->FormValue)) {
			ew_AddMessage($gsFormError, $this->AuditoriaResultado->FldErrMsg());
		}
		if (!ew_CheckInteger($this->AuditoriaPublicar->FormValue)) {
			ew_AddMessage($gsFormError, $this->AuditoriaPublicar->FldErrMsg());
		}
		if (!ew_CheckInteger($this->AuditoriaEstado->FormValue)) {
			ew_AddMessage($gsFormError, $this->AuditoriaEstado->FldErrMsg());
		}
		if (!ew_CheckEuroDate($this->AuditoriaFechaCierre->FormValue)) {
			ew_AddMessage($gsFormError, $this->AuditoriaFechaCierre->FldErrMsg());
		}

		// Return validate result
		$ValidateForm = ($gsFormError == "");

		// Call Form_CustomValidate event
		$sFormCustomError = "";
		$ValidateForm = $ValidateForm && $this->Form_CustomValidate($sFormCustomError);
		if ($sFormCustomError <> "") {
			ew_AddMessage($gsFormError, $sFormCustomError);
		}
		return $ValidateForm;
	}

	// Update record based on key values
	function EditRow() {
		global $conn, $Security, $Language;
		$sFilter = $this->KeyFilter();
		$this->CurrentFilter = $sFilter;
		$sSql = $this->SQL();
		$conn->raiseErrorFn = 'ew_ErrorFn';
		$rs = $conn->Execute($sSql);
		$conn->raiseErrorFn = '';
		if ($rs === FALSE)
			return FALSE;
		if ($rs->EOF) {
			$EditRow = FALSE; // Update Failed
		} else {

			// Save old values
			$rsold = &$rs->fields;
			$this->LoadDbValues($rsold);
			$rsnew = array();

			// AuditoriaFecha
			$this->AuditoriaFecha->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->AuditoriaFecha->CurrentValue, 7), NULL, $this->AuditoriaFecha->ReadOnly);

			// AuditoriaTipo
			$this->AuditoriaTipo->SetDbValueDef($rsnew, $this->AuditoriaTipo->CurrentValue, NULL, $this->AuditoriaTipo->ReadOnly);

			// AuditoriaSucursal
			$this->AuditoriaSucursal->SetDbValueDef($rsnew, $this->AuditoriaSucursal->CurrentValue, NULL, $this->AuditoriaSucursal->ReadOnly);

			// AuditoriaCreo
			$this->AuditoriaCreo->SetDbValueDef($rsnew, $this->AuditoriaCreo->CurrentValue, NULL, $this->AuditoriaCreo->ReadOnly);

			// AuditoriaResponsable
			$this->AuditoriaResponsable->SetDbValueDef($rsnew, $this->AuditoriaResponsable->CurrentValue, NULL, $this->AuditoriaResponsable->ReadOnly);

			// AuditoriaFechaVisita
			$this->AuditoriaFechaVisita->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->AuditoriaFechaVisita->CurrentValue, 7), NULL, $this->AuditoriaFechaVisita->ReadOnly);

			// AuditoriaResultado
			$this->AuditoriaResultado->SetDbValueDef($rsnew, $this->AuditoriaResultado->CurrentValue, NULL, $this->AuditoriaResultado->ReadOnly);

			// AuditoriaObservacion
			$this->AuditoriaObservacion->SetDbValueDef($rsnew, $this->AuditoriaObservacion->CurrentValue, NULL, $this->AuditoriaObservacion->ReadOnly);

			// AuditoriaPublicar
			$this->AuditoriaPublicar->SetDbValueDef($rsnew, $this->AuditoriaPublicar->CurrentValue, NULL, $this->AuditoriaPublicar->ReadOnly);

			// AuditoriaEstado
			$this->AuditoriaEstado->SetDbValueDef($rsnew, $this->AuditoriaEstado->CurrentValue, NULL, $this->AuditoriaEstado->ReadOnly);

			// AuditoriaDescargo
			$this->AuditoriaDescargo->SetDbValueDef($rsnew, $this->AuditoriaDescargo->CurrentValue, NULL, $this->AuditoriaDescargo->ReadOnly);

			// AuditoriaFechaCierre
			$this->AuditoriaFechaCierre->SetDbValueDef($rsnew, ew_UnFormatDateTime($this->AuditoriaFechaCierre->CurrentValue, 7), NULL, $this->AuditoriaFechaCierre->ReadOnly);

			// Call Row Updating event
			$bUpdateRow = $this->Row_Updating($rsold, $rsnew);
			if ($bUpdateRow) {
				$conn->raiseErrorFn = 'ew_ErrorFn';
				if (count($rsnew) > 0)
					$EditRow = $this->Update($rsnew, "", $rsold);
				else
					$EditRow = TRUE; // No field to update
				$conn->raiseErrorFn = '';
				if ($EditRow) {
				}
			} else {
				if ($this->getSuccessMessage() <> "" || $this->getFailureMessage() <> "") {

					// Use the message, do nothing
				} elseif ($this->CancelMessage <> "") {
					$this->setFailureMessage($this->CancelMessage);
					$this->CancelMessage = "";
				} else {
					$this->setFailureMessage($Language->Phrase("UpdateCancelled"));
				}
				$EditRow = FALSE;
			}
		}

		// Call Row_Updated event
		if ($EditRow)
			$this->Row_Updated($rsold, $rsnew);
		$rs->Close();
		return $EditRow;
	}

	// Set up Breadcrumb
	function SetupBreadcrumb() {
		global $Breadcrumb, $Language;
		$Breadcrumb = new cBreadcrumb();
		$Breadcrumb->Add("list", $this->TableVar, "auditoriaslist.php", $this->TableVar, TRUE);
		$PageId = "edit";
		$Breadcrumb->Add("edit", $PageId, ew_CurrentUrl());
	}

	// Page Load event
	function Page_Load() {

		//echo "Page Load";
	}

	// Page Unload event
	function Page_Unload() {

		//echo "Page Unload";
	}

	// Page Redirecting event
	function Page_Redirecting(&$url) {

		// Example:
		//$url = "your URL";

	}

	// Message Showing event
	// $type = ''|'success'|'failure'|'warning'
	function Message_Showing(&$msg, $type) {
		if ($type == 'success') {

			//$msg = "your success message";
		} elseif ($type == 'failure') {

			//$msg = "your failure message";
		} elseif ($type == 'warning') {

			//$msg = "your warning message";
		} else {

			//$msg = "your message";
		}
	}

	// Page Render event
	function Page_Render() {

		//echo "Page Render";
	}

	// Page Data Rendering event
	function Page_DataRendering(&$header) {

		// Example:
		//$header = "your header";

	}

	// Page Data Rendered event
	function Page_DataRendered(&$footer) {

		// Example:
		//$footer = "your footer";

	}

	// Form Custom Validate event
	function Form_CustomValidate(&$CustomError) {

		// Return error message in CustomError
		return TRUE;
	}
}
?>
<?php ew_Header(FALSE) ?>
<?php

// Create page object
if (!isset($auditorias_edit)) $auditorias_edit = new cauditorias_edit();

// Page init
$auditorias_edit->Page_Init();

// Page main
$auditorias_edit->Page_Main();

// Global Page Rendering event (in userfn*.php)
Page_Rendering();

// Page Rendering event
$auditorias_edit->Page_Render();
?>
<?php include_once "header.php" ?>
<script type="text/javascript">

// Page object
var auditorias_edit = new ew_Page("auditorias_edit");
auditorias_edit.PageID = "edit"; // Page ID
var EW_PAGE_ID = auditorias_edit.PageID; // For backward compatibility

// Form object
var fauditoriasedit = new ew_Form("fauditoriasedit");

// Validate form
fauditoriasedit.Validate = function() {
	if (!this.ValidateRequired)
		return true; // Ignore validation
	var $ = jQuery, fobj = this.GetForm(), $fobj = $(fobj);
	this.PostAutoSuggest();
	if ($fobj.find("#a_confirm").val() == "F")
		return true;
	var elm, felm, uelm, addcnt = 0;
	var $k = $fobj.find("#" + this.FormKeyCountName); // Get key_count
	var rowcnt = ($k[0]) ? parseInt($k.val(), 10) : 1;
	var startcnt = (rowcnt == 0) ? 0 : 1; // Check rowcnt == 0 => Inline-Add
	var gridinsert = $fobj.find("#a_list").val() == "gridinsert";
	for (var i = startcnt; i <= rowcnt; i++) {
		var infix = ($k[0]) ? String(i) : "";
		$fobj.data("rowindex", infix);
			elm = this.GetElements("x" + infix + "_AuditoriaFecha");
			if (elm && !ew_CheckEuroDate(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($auditorias->AuditoriaFecha->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_AuditoriaTipo");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($auditorias->AuditoriaTipo->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_AuditoriaSucursal");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($auditorias->AuditoriaSucursal->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_AuditoriaCreo");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($auditorias->AuditoriaCreo->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_AuditoriaResponsable");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($auditorias->AuditoriaResponsable->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_AuditoriaFechaVisita");
			if (elm && !ew_CheckEuroDate(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($auditorias->AuditoriaFechaVisita->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_AuditoriaResultado");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($auditorias->AuditoriaResultado->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_AuditoriaPublicar");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($auditorias->AuditoriaPublicar->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_AuditoriaEstado");
			if (elm && !ew_CheckInteger(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($auditorias->AuditoriaEstado->FldErrMsg()) ?>");
			elm = this.GetElements("x" + infix + "_AuditoriaFechaCierre");
			if (elm && !ew_CheckEuroDate(elm.value))
				return this.OnError(elm, "<?php echo ew_JsEncode2($auditorias->AuditoriaFechaCierre->FldErrMsg()) ?>");

			// Set up row object
			ew_ElementsToRow(fobj);

			// Fire Form_CustomValidate event
			if (!this.Form_CustomValidate(fobj))
				return false;
	}

	// Process detail forms
	var dfs = $fobj.find("input[name='detailpage']").get();
	for (var i = 0; i < dfs.length; i++) {
		var df = dfs[i], val = df.value;
		if (val && ewForms[val])
			if (!ewForms[val].Validate())
				return false;
	}
	return true;
}

// Form_CustomValidate event
fauditoriasedit.Form_CustomValidate = 
 function(fobj) { // DO NOT CHANGE THIS LINE!

 	// Your custom validation code here, return false if invalid. 
 	return true;
 }

// Use JavaScript validation or not
<?php if (EW_CLIENT_VALIDATE) { ?>
fauditoriasedit.ValidateRequired = true;
<?php } else { ?>
fauditoriasedit.ValidateRequired = false; 
<?php } ?>

// Dynamic selection lists
// Form object for search

</script>
<script type="text/javascript">

// Write your client script here, no need to add script tags.
</script>
<?php $Breadcrumb->Render(); ?>
<?php $auditorias_edit->ShowPageHeader(); ?>
<?php
$auditorias_edit->ShowMessage();
?>
<form name="fauditoriasedit" id="fauditoriasedit" class="ewForm form-inline" action="<?php echo ew_CurrentPage() ?>" method="post">
<input type="hidden" name="t" value="auditorias">
<input type="hidden" name="a_edit" id="a_edit" value="U">
<table class="ewGrid"><tr><td>
<table id="tbl_auditoriasedit" class="table table-bordered table-striped">
<?php if ($auditorias->Auditoria->Visible) { // Auditoria ?>
	<tr id="r_Auditoria">
		<td><span id="elh_auditorias_Auditoria"><?php echo $auditorias->Auditoria->FldCaption() ?></span></td>
		<td<?php echo $auditorias->Auditoria->CellAttributes() ?>>
<span id="el_auditorias_Auditoria" class="control-group">
<span<?php echo $auditorias->Auditoria->ViewAttributes() ?>>
<?php echo $auditorias->Auditoria->EditValue ?></span>
</span>
<input type="hidden" data-field="x_Auditoria" name="x_Auditoria" id="x_Auditoria" value="<?php echo ew_HtmlEncode($auditorias->Auditoria->CurrentValue) ?>">
<?php echo $auditorias->Auditoria->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($auditorias->AuditoriaFecha->Visible) { // AuditoriaFecha ?>
	<tr id="r_AuditoriaFecha">
		<td><span id="elh_auditorias_AuditoriaFecha"><?php echo $auditorias->AuditoriaFecha->FldCaption() ?></span></td>
		<td<?php echo $auditorias->AuditoriaFecha->CellAttributes() ?>>
<span id="el_auditorias_AuditoriaFecha" class="control-group">
<input type="text" data-field="x_AuditoriaFecha" name="x_AuditoriaFecha" id="x_AuditoriaFecha" placeholder="<?php echo ew_HtmlEncode($auditorias->AuditoriaFecha->PlaceHolder) ?>" value="<?php echo $auditorias->AuditoriaFecha->EditValue ?>"<?php echo $auditorias->AuditoriaFecha->EditAttributes() ?>>
</span>
<?php echo $auditorias->AuditoriaFecha->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($auditorias->AuditoriaTipo->Visible) { // AuditoriaTipo ?>
	<tr id="r_AuditoriaTipo">
		<td><span id="elh_auditorias_AuditoriaTipo"><?php echo $auditorias->AuditoriaTipo->FldCaption() ?></span></td>
		<td<?php echo $auditorias->AuditoriaTipo->CellAttributes() ?>>
<span id="el_auditorias_AuditoriaTipo" class="control-group">
<input type="text" data-field="x_AuditoriaTipo" name="x_AuditoriaTipo" id="x_AuditoriaTipo" size="30" placeholder="<?php echo ew_HtmlEncode($auditorias->AuditoriaTipo->PlaceHolder) ?>" value="<?php echo $auditorias->AuditoriaTipo->EditValue ?>"<?php echo $auditorias->AuditoriaTipo->EditAttributes() ?>>
</span>
<?php echo $auditorias->AuditoriaTipo->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($auditorias->AuditoriaSucursal->Visible) { // AuditoriaSucursal ?>
	<tr id="r_AuditoriaSucursal">
		<td><span id="elh_auditorias_AuditoriaSucursal"><?php echo $auditorias->AuditoriaSucursal->FldCaption() ?></span></td>
		<td<?php echo $auditorias->AuditoriaSucursal->CellAttributes() ?>>
<span id="el_auditorias_AuditoriaSucursal" class="control-group">
<input type="text" data-field="x_AuditoriaSucursal" name="x_AuditoriaSucursal" id="x_AuditoriaSucursal" size="30" placeholder="<?php echo ew_HtmlEncode($auditorias->AuditoriaSucursal->PlaceHolder) ?>" value="<?php echo $auditorias->AuditoriaSucursal->EditValue ?>"<?php echo $auditorias->AuditoriaSucursal->EditAttributes() ?>>
</span>
<?php echo $auditorias->AuditoriaSucursal->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($auditorias->AuditoriaCreo->Visible) { // AuditoriaCreo ?>
	<tr id="r_AuditoriaCreo">
		<td><span id="elh_auditorias_AuditoriaCreo"><?php echo $auditorias->AuditoriaCreo->FldCaption() ?></span></td>
		<td<?php echo $auditorias->AuditoriaCreo->CellAttributes() ?>>
<span id="el_auditorias_AuditoriaCreo" class="control-group">
<input type="text" data-field="x_AuditoriaCreo" name="x_AuditoriaCreo" id="x_AuditoriaCreo" size="30" placeholder="<?php echo ew_HtmlEncode($auditorias->AuditoriaCreo->PlaceHolder) ?>" value="<?php echo $auditorias->AuditoriaCreo->EditValue ?>"<?php echo $auditorias->AuditoriaCreo->EditAttributes() ?>>
</span>
<?php echo $auditorias->AuditoriaCreo->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($auditorias->AuditoriaResponsable->Visible) { // AuditoriaResponsable ?>
	<tr id="r_AuditoriaResponsable">
		<td><span id="elh_auditorias_AuditoriaResponsable"><?php echo $auditorias->AuditoriaResponsable->FldCaption() ?></span></td>
		<td<?php echo $auditorias->AuditoriaResponsable->CellAttributes() ?>>
<span id="el_auditorias_AuditoriaResponsable" class="control-group">
<input type="text" data-field="x_AuditoriaResponsable" name="x_AuditoriaResponsable" id="x_AuditoriaResponsable" size="30" placeholder="<?php echo ew_HtmlEncode($auditorias->AuditoriaResponsable->PlaceHolder) ?>" value="<?php echo $auditorias->AuditoriaResponsable->EditValue ?>"<?php echo $auditorias->AuditoriaResponsable->EditAttributes() ?>>
</span>
<?php echo $auditorias->AuditoriaResponsable->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($auditorias->AuditoriaFechaVisita->Visible) { // AuditoriaFechaVisita ?>
	<tr id="r_AuditoriaFechaVisita">
		<td><span id="elh_auditorias_AuditoriaFechaVisita"><?php echo $auditorias->AuditoriaFechaVisita->FldCaption() ?></span></td>
		<td<?php echo $auditorias->AuditoriaFechaVisita->CellAttributes() ?>>
<span id="el_auditorias_AuditoriaFechaVisita" class="control-group">
<input type="text" data-field="x_AuditoriaFechaVisita" name="x_AuditoriaFechaVisita" id="x_AuditoriaFechaVisita" placeholder="<?php echo ew_HtmlEncode($auditorias->AuditoriaFechaVisita->PlaceHolder) ?>" value="<?php echo $auditorias->AuditoriaFechaVisita->EditValue ?>"<?php echo $auditorias->AuditoriaFechaVisita->EditAttributes() ?>>
</span>
<?php echo $auditorias->AuditoriaFechaVisita->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($auditorias->AuditoriaResultado->Visible) { // AuditoriaResultado ?>
	<tr id="r_AuditoriaResultado">
		<td><span id="elh_auditorias_AuditoriaResultado"><?php echo $auditorias->AuditoriaResultado->FldCaption() ?></span></td>
		<td<?php echo $auditorias->AuditoriaResultado->CellAttributes() ?>>
<span id="el_auditorias_AuditoriaResultado" class="control-group">
<input type="text" data-field="x_AuditoriaResultado" name="x_AuditoriaResultado" id="x_AuditoriaResultado" size="30" placeholder="<?php echo ew_HtmlEncode($auditorias->AuditoriaResultado->PlaceHolder) ?>" value="<?php echo $auditorias->AuditoriaResultado->EditValue ?>"<?php echo $auditorias->AuditoriaResultado->EditAttributes() ?>>
</span>
<?php echo $auditorias->AuditoriaResultado->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($auditorias->AuditoriaObservacion->Visible) { // AuditoriaObservacion ?>
	<tr id="r_AuditoriaObservacion">
		<td><span id="elh_auditorias_AuditoriaObservacion"><?php echo $auditorias->AuditoriaObservacion->FldCaption() ?></span></td>
		<td<?php echo $auditorias->AuditoriaObservacion->CellAttributes() ?>>
<span id="el_auditorias_AuditoriaObservacion" class="control-group">
<input type="text" data-field="x_AuditoriaObservacion" name="x_AuditoriaObservacion" id="x_AuditoriaObservacion" size="30" maxlength="255" placeholder="<?php echo ew_HtmlEncode($auditorias->AuditoriaObservacion->PlaceHolder) ?>" value="<?php echo $auditorias->AuditoriaObservacion->EditValue ?>"<?php echo $auditorias->AuditoriaObservacion->EditAttributes() ?>>
</span>
<?php echo $auditorias->AuditoriaObservacion->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($auditorias->AuditoriaPublicar->Visible) { // AuditoriaPublicar ?>
	<tr id="r_AuditoriaPublicar">
		<td><span id="elh_auditorias_AuditoriaPublicar"><?php echo $auditorias->AuditoriaPublicar->FldCaption() ?></span></td>
		<td<?php echo $auditorias->AuditoriaPublicar->CellAttributes() ?>>
<span id="el_auditorias_AuditoriaPublicar" class="control-group">
<input type="text" data-field="x_AuditoriaPublicar" name="x_AuditoriaPublicar" id="x_AuditoriaPublicar" size="30" placeholder="<?php echo ew_HtmlEncode($auditorias->AuditoriaPublicar->PlaceHolder) ?>" value="<?php echo $auditorias->AuditoriaPublicar->EditValue ?>"<?php echo $auditorias->AuditoriaPublicar->EditAttributes() ?>>
</span>
<?php echo $auditorias->AuditoriaPublicar->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($auditorias->AuditoriaEstado->Visible) { // AuditoriaEstado ?>
	<tr id="r_AuditoriaEstado">
		<td><span id="elh_auditorias_AuditoriaEstado"><?php echo $auditorias->AuditoriaEstado->FldCaption() ?></span></td>
		<td<?php echo $auditorias->AuditoriaEstado->CellAttributes() ?>>
<span id="el_auditorias_AuditoriaEstado" class="control-group">
<input type="text" data-field="x_AuditoriaEstado" name="x_AuditoriaEstado" id="x_AuditoriaEstado" size="30" placeholder="<?php echo ew_HtmlEncode($auditorias->AuditoriaEstado->PlaceHolder) ?>" value="<?php echo $auditorias->AuditoriaEstado->EditValue ?>"<?php echo $auditorias->AuditoriaEstado->EditAttributes() ?>>
</span>
<?php echo $auditorias->AuditoriaEstado->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($auditorias->AuditoriaDescargo->Visible) { // AuditoriaDescargo ?>
	<tr id="r_AuditoriaDescargo">
		<td><span id="elh_auditorias_AuditoriaDescargo"><?php echo $auditorias->AuditoriaDescargo->FldCaption() ?></span></td>
		<td<?php echo $auditorias->AuditoriaDescargo->CellAttributes() ?>>
<span id="el_auditorias_AuditoriaDescargo" class="control-group">
<textarea data-field="x_AuditoriaDescargo" name="x_AuditoriaDescargo" id="x_AuditoriaDescargo" cols="35" rows="4" placeholder="<?php echo ew_HtmlEncode($auditorias->AuditoriaDescargo->PlaceHolder) ?>"<?php echo $auditorias->AuditoriaDescargo->EditAttributes() ?>><?php echo $auditorias->AuditoriaDescargo->EditValue ?></textarea>
</span>
<?php echo $auditorias->AuditoriaDescargo->CustomMsg ?></td>
	</tr>
<?php } ?>
<?php if ($auditorias->AuditoriaFechaCierre->Visible) { // AuditoriaFechaCierre ?>
	<tr id="r_AuditoriaFechaCierre">
		<td><span id="elh_auditorias_AuditoriaFechaCierre"><?php echo $auditorias->AuditoriaFechaCierre->FldCaption() ?></span></td>
		<td<?php echo $auditorias->AuditoriaFechaCierre->CellAttributes() ?>>
<span id="el_auditorias_AuditoriaFechaCierre" class="control-group">
<input type="text" data-field="x_AuditoriaFechaCierre" name="x_AuditoriaFechaCierre" id="x_AuditoriaFechaCierre" placeholder="<?php echo ew_HtmlEncode($auditorias->AuditoriaFechaCierre->PlaceHolder) ?>" value="<?php echo $auditorias->AuditoriaFechaCierre->EditValue ?>"<?php echo $auditorias->AuditoriaFechaCierre->EditAttributes() ?>>
</span>
<?php echo $auditorias->AuditoriaFechaCierre->CustomMsg ?></td>
	</tr>
<?php } ?>
</table>
</td></tr></table>
<button class="btn btn-primary ewButton" name="btnAction" id="btnAction" type="submit"><?php echo $Language->Phrase("EditBtn") ?></button>
</form>
<script type="text/javascript">
fauditoriasedit.Init();
<?php if (EW_MOBILE_REFLOW && ew_IsMobile()) { ?>
ew_Reflow();
<?php } ?>
</script>
<?php
$auditorias_edit->ShowPageFooter();
if (EW_DEBUG_ENABLED)
	echo ew_DebugMsg();
?>
<script type="text/javascript">

// Write your table-specific startup script here
// document.write("page loaded");

</script>
<?php include_once "footer.php" ?>
<?php
$auditorias_edit->Page_Terminate();
?>
